package org.example;

import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Element;

/**
 * Hello world!
 *
 */
public class Ehcache2
{
    public static void main( String[] args )
    {
        CacheManager manager=new CacheManager(Ehcache2.class.getResource("/ehcache.xml"));
        Cache cache = manager.getCache("userCache");
        cache.put(new Element("key1", "value1"));
        cache.put(new Element("key2", "value2"));
        cache.put(new Element("key3", "value3"));
        System.out.println("getMemoryStoreSize:"+cache.getMemoryStoreSize());
        Element e = cache.get("key1");
        String value = (String) e.getObjectValue();
        System.out.println( "Hello World!" +value);
    }
}
